home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / H-I / HCBalloon 1.2 Stack.cpt / HCBalloon 1.2 Stack / card_3035.txt < prev    next >
Text File  |  1991-09-20  |  5KB  |  170 lines

  1. -- card: 3035 from stack: in.2 Stack
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 2669
  5. -- name:  idle
  6.  
  7.  
  8. -- part 4 (field)
  9. -- low flags: 05
  10. -- high flags: 0007
  11. -- rect: left=2 top=2 right=240 bottom=318
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 0
  15. -- font id: 16
  16. -- text size: 14
  17. -- style flags: 0
  18. -- line height: 18
  19. -- part name: 
  20. ----- HyperTalk script -----
  21. on mousewithin
  22.   HCBalloon "This field explains the HCBalloon XCMD.", 50, 30
  23. end mousewithin
  24.  
  25. on mousedown
  26.   if the clicktext is "variation code" then
  27.     visual effect iris open
  28.     go next card
  29.   end if
  30. end mousedown
  31.  
  32.  
  33.  
  34. -- part 6 (button)
  35. -- low flags: 00
  36. -- high flags: 8000
  37. -- rect: left=61 top=245 right=294 bottom=155
  38. -- title width / last selected line: 0
  39. -- icon id / first selected line: 21921 / 21921
  40. -- text alignment: 1
  41. -- font id: 0
  42. -- text size: 12
  43. -- style flags: 0
  44. -- line height: 16
  45. -- part name: Toggle Balloon Help
  46. ----- HyperTalk script -----
  47. on mouseUp
  48.   if the icon of me is "1290" then
  49.     HCBalloon "off"
  50.     set the icon of me to "big off"
  51.   else
  52.     HCBalloon "on"
  53.     set the icon of me to "big on"
  54.   end if
  55. end mouseUp
  56.  
  57. on mousewithin
  58.   HCBalloon "Click this button to turn Balloon Help off.", 36,44,6
  59. end mousewithin
  60.  
  61.  
  62.  
  63.  
  64. -- part 9 (button)
  65. -- low flags: 00
  66. -- high flags: A000
  67. -- rect: left=185 top=245 right=293 bottom=239
  68. -- title width / last selected line: 0
  69. -- icon id / first selected line: 1008 / 1008
  70. -- text alignment: 1
  71. -- font id: 0
  72. -- text size: 12
  73. -- style flags: 0
  74. -- line height: 16
  75. -- part name: Print docs
  76. ----- HyperTalk script -----
  77. on mouseUp
  78.   print cd fld 1
  79. end mouseUp
  80.  
  81. on mousewithin
  82.   HCBalloon "Click here to print out the documentation in the scrolling" && "field.", 45, 40, 5
  83. end mousewithin
  84.  
  85.  
  86. -- part contents for card part 4
  87. -- note: style data is present
  88. ----- text -----
  89.  
  90. HCBalloon 1.2 XCMD
  91. by Len Saaf ¬©1991, Raleigh Associates
  92.  
  93. This XCMD may be used without cost if used in non-commercial stacks. It is freely distributable.
  94.  
  95. HCBalloon is a simple XCMD that provides Balloon Help for Hypercard stacks. It can also turn Balloon Help on and off and can check to see if  Balloon Help is active. You can also specify the position of the balloon's tip and the place where the tip joins the balloon. HCBalloon is compatible with the Helium system extension. Help balloons are not available on systems prior to 7.0. However, this XCMD will not crash systems prior to 7.0. The size of the XCMD is 2752 bytes.
  96.  
  97.  
  98. Usage:
  99.  
  100. HCBalloon message [, x-offset, y-offset 
  101.     [, variation code]]
  102.  
  103. Copy the XCMD to a stack and use the following syntax to add balloon help to a button or a field:
  104.  
  105. on MouseWithin
  106.     HCBalloon "This text appears in ¬¨
  107.     a help balloon."
  108. end MouseWithin
  109.  
  110. That's all there is to it. Of course, you need to have Balloon Help turned on or it won't work! The balloon will disappear when the cursor leaves the rect of the target (the target means the button or field for which help is being provided). If that‚Äôs all you want to do then stop reading now! :‚Äì)
  111.  
  112. To turn Balloon Help on with the XCMD:
  113.  
  114.     HCBalloon "on"
  115.  
  116. To turn Balloon Help off:
  117.  
  118.     HCBalloon "off"
  119.  
  120. To check the status of Balloon Help (an example):
  121.  
  122.     HCBalloon "query"
  123.     if the result is "true" then
  124.       put "Balloon Help is on."
  125.     else
  126.       put "Balloon Help is off."
  127.     end if
  128.  
  129. The x-offset and y-offset values specify the distance left and above the lower right corner of the target where the tip of the help balloon will appear. By default the tip of the help balloon is located at the lower right corner of the target. To put the tip a little closer to the center of the target, specify a small x- and y-offset. For example:
  130.  
  131.     HCBalloon "This is help.", 10, 10
  132.  
  133. You can also chooses a particular balloon style by specifying a variation code.  (To see the different balloon styles, click on the grouped text that is underlined above.) For example, say you have a button that is 60 pixels wide and 50 pixels high. Suppose you want the help balloon to appear at the upper left corner of the button. This would do the trick:
  134.  
  135.     HCBalloon "More help.", 60, 50, 5
  136.  
  137.  
  138. Any errors encountered are reported in the result. If a balloon is displayed successfully, the result is empty. Here are the errors and diagnostics returned:
  139.  
  140. HCBalloon error: Wrong number of arguments
  141.  
  142. The number of arguments should be 1, 3, or 4.
  143.  
  144. HCBalloon error: HMSetBalloons error
  145.  
  146. An error was returned from the HMSetBalloons toolbox call.
  147.  
  148. HCBalloon error: HMShowBalloon error
  149.  
  150. An error was returned from the HMShowBalloon toolbox call.
  151.  
  152. HCBalloon error: System 7.0 or higher required for balloon help
  153.  
  154. HCBalloon error: A balloon is already showing
  155.  
  156. HCBalloon doesn't display a balloon if another is already showing.
  157.  
  158. HCBalloon error: Balloon help is turned off
  159.  
  160.  
  161.  
  162. Thanks to Larry Slack for testing and suggestions!
  163.  
  164. Bug reports and/or comments are welcome.
  165.  
  166. Len Saaf
  167. 52 Raleigh St.
  168. Rochester, NY 14620
  169.  
  170. saaf@joker.optics.rochester.edu